package cn.zyq.ykb.controller.tk;

import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.annotation.Log;
import cn.zyq.ykb.system.ry.enums.BusinessType;
import cn.zyq.ykb.beans.tk.Change;
import cn.zyq.ykb.service.tk.ChangeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.zyq.ykb.system.common.PageParam;


/**
 * 【请填写功能名称】Controller
 * @author SystemAuth
 * @date 2023-07-03
 */

@RestController(value = "H5ChangeController")
@RequestMapping("/api/change")
@Api(tags = "【请填写功能名称】接口")
public class ChangeController extends BaseController {

    @Autowired
    private ChangeService changeService;

    /**
     * 查询【请填写功能名称】列表
     */
    @ApiOperation(value = "列表", response = Change.class)
    @PostMapping("/list")
    public Object list(@RequestBody PageParam pageParam) {
        return this.changeService.selectChangeList(pageParam);
    }

    /**
     * 新增【请填写功能名称】
     */
    @ApiOperation(value = "新增")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public Object add(@RequestBody Change change) {
        return this.changeService.insertChange(change);
    }

    /**
     * 删除【请填写功能名称】
     */
    @ApiOperation(value = "删除")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/remove/{id}")
    public Object remove(@PathVariable Integer id) {
        return this.changeService.deleteChangeByIds(id);
    }

    /**
     * 全部清空
     */
    @ApiOperation(value = "全部清空")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/batchRemove")
    public Object batchRemove() {
        return this.changeService.batchRemove();
    }

    /**
     * 首页统计
     */
    @ApiOperation(value = "首页统计")
    @GetMapping("/total/{tUserID}")
    public Object total(@PathVariable Integer tUserID) {
        return this.changeService.total(tUserID);
    }

}
